/* jshint indent: 1 */

/**
 *
 * @param sequelize
 * @param DataTypes
 * @return {*|ModelCtor<Model>|void}
 */
module.exports = function(sequelize, DataTypes) {
	return sequelize.define('class', {
		class_id: {
			type: DataTypes.INTEGER,
			allowNull: false,
			primaryKey: true
		},
		name: {
			type: DataTypes.STRING(255),
			allowNull: false
		},
		college_id: {
			type: DataTypes.INTEGER,
			allowNull: true,
			references: {
				model: {
					tableName: 'college',
				},
				key: 'college_id'
			}
		},
		master: {
			type: DataTypes.INTEGER,
			allowNull: true,
			comment: '班主任',
			references: {
				model: {
					tableName: 'teacher',
				},
				key: 'tea_id'
			}
		}
	}, {
		sequelize,
		tableName: 'class',
		timestamps: false
	});
};
